package xyz.xiangyushui.util;

import java.sql.PreparedStatement;
import java.sql.SQLException;

import xyz.xiangyushui.dao.connectionFactory.DBConnectoryFactory;


public class TestConnection {
	private  DBConnectoryFactory factory;
	
	
	public TestConnection(DBConnectoryFactory factory) {
		super();
		this.factory = factory;
	}

	public void insertData(){
		PreparedStatement ps=null;
		try {
			ps=factory.getConnection().prepareStatement("insert into  test(`name`) values(?) ;");
			ps.setString(1, "hello");
			ps.execute();
		} catch (SQLException e) {
			e.printStackTrace();
		}finally{
			try {
				if(ps!=null)
					ps.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
	}
}
